package start

import (
	"os"

	"gitee.com/keepalived_0807/Vblog/conf"
	"github.com/spf13/cobra"
)

var (
	testParam string
	Cmd       = &cobra.Command{
		Use:   "start",
		Short: "start vblog apiserver",
		Long:  ``,
		Run: func(cmd *cobra.Command, args []string) {
			configPath := os.Getenv("CONFIG_PATH")
			if configPath == "" {
				configPath = "etc/application.yaml"
			}
			cobra.CheckErr(conf.LoadConfigFromYaml(configPath))

			cobra.CheckErr(conf.C().Application.Start())
		},
	}
)

func init() {
	Cmd.Flags().StringVarP(&testParam, "test", "t", "test", "test flag")
}
